﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common.Net.DataStructures;
using Common.Net.DesignByContract;
using Common.Net.Utilities;

namespace ClearUnit.TestRunners
{
    public abstract class TestRunnerBase<TRunResult> : SingleRun<TRunResult>, ITestInfoEventNotifier
        where TRunResult : TestRunInfo
    {
        protected void OnTestInfoEvent(TestRunInfo info)
        {
            var tmp = TestInfoEvent;

            if (tmp != null)
                tmp(info);
        }

        public TestRunnerBase(Action<TestRunInfo>[] interestedListeners)
        {
            foreach (var listener in interestedListeners)
                TestInfoEvent += listener;
        }

        public event Action<TestRunInfo> TestInfoEvent;
    }
}
